# Copyright 2024 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

package(
    default_visibility = ["//visibility:public"],
    licenses = ["notice"],
)

cc_library(
    name = "sai",
    srcs = ["sai.cc"],
    hdrs = ["sai.h"],
    deps = [
        "//gutil/gutil:collections",
        "//gutil/gutil:status",
        "//p4_pdpi:ir_cc_proto",
        "//p4_pdpi/internal:ordered_map",
        "//p4_symbolic/ir",
        "//p4_symbolic/ir:ir_cc_proto",
        "//p4_symbolic/symbolic:operators",
        "//p4_symbolic/symbolic:solver_state",
        "//p4_symbolic/symbolic:values",
        "@com_github_z3prover_z3//:api",
        "@com_google_absl//absl/container:flat_hash_set",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/status:statusor",
        "@com_google_absl//absl/strings",
	"@com_google_absl//absl/strings:str_format",
    ],
)

cc_library(
    name = "sai_coverage_goals",
    testonly = True,
    hdrs = ["sai_coverage_goals.h"],
    deps = [
        "//gutil/gutil:testing",
        "//p4_symbolic/packet_synthesizer:coverage_goal_cc_proto",
    ],
)

cc_test(
    name = "sai_test",
    srcs = ["sai_test.cc"],
    deps = [
        ":sai",
        "//gutil/gutil:proto",
        "//gutil/gutil:status_matchers",
        "//gutil/gutil:test_artifact_writer",
        "//gutil/gutil:testing",
        "//p4_pdpi:ir",
        "//p4_pdpi:pd",
        "//p4_symbolic/symbolic",
        "//p4_symbolic/symbolic:values",
        "//sai_p4/instantiations/google:instantiations",
        "//sai_p4/instantiations/google:sai_nonstandard_platforms_cc",
        "//sai_p4/instantiations/google:sai_pd_cc_proto",
        "@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
        "@com_github_z3prover_z3//:api",
        "@com_google_absl//absl/status",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "packet_synthesizer_test",
    timeout = "long",
    srcs = ["packet_synthesizer_test.cc"],
    deps = [
        ":sai",
        "//gutil/gutil:proto",
        "//gutil/gutil:status_matchers",
        "//gutil/gutil:test_artifact_writer",
        "//gutil/gutil:testing",
        "//p4_pdpi:ir",
        "//p4_pdpi:ir_cc_proto",
        "//p4_pdpi:pd",
        "//p4_pdpi/packetlib",
        "//p4_pdpi/packetlib:packetlib_cc_proto",
        "//p4_symbolic/packet_synthesizer",
        "//p4_symbolic/packet_synthesizer:packet_synthesizer_cc_proto",
        "//sai_p4/instantiations/google:instantiations",
        "//sai_p4/instantiations/google:sai_nonstandard_platforms_cc",
        "//sai_p4/instantiations/google:sai_p4info_cc",
        "//sai_p4/instantiations/google:sai_pd_cc_proto",
	"@com_github_google_glog//:glog",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/strings",
        "@com_google_googletest//:gtest_main",
    ],
)

cc_test(
    name = "criteria_generator_test",
    srcs = ["criteria_generator_test.cc"],
    deps = [
        "//gutil/gutil:proto_matchers",
        "//gutil/gutil:status_matchers",
        "//gutil/gutil:testing",
        "//p4_pdpi:ir_cc_proto",
        "//p4_pdpi:pd",
        "//p4_symbolic/packet_synthesizer",
        "//p4_symbolic/packet_synthesizer:coverage_goal_cc_proto",
        "//p4_symbolic/packet_synthesizer:criteria_generator",
        "//p4_symbolic/packet_synthesizer:packet_synthesis_criteria_cc_proto",
        "//p4_symbolic/packet_synthesizer:packet_synthesizer_cc_proto",
        "//sai_p4/instantiations/google:instantiations",
        "//sai_p4/instantiations/google:sai_nonstandard_platforms_cc",
        "//sai_p4/instantiations/google:sai_p4info_cc",
        "//sai_p4/instantiations/google:sai_pd_cc_proto",
        "@com_github_p4lang_p4runtime//:p4runtime_cc_proto",
        "@com_google_absl//absl/log",
        "@com_google_absl//absl/types:optional",
        "@com_google_googletest//:gtest_main",
        "@com_google_protobuf//:protobuf",
    ],
)
